package com.boot.stream;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.function.Consumer;

/**
 * @author 霜寒 <1621856595@qq.com>
 * @date 2021/7/31 21:39
 **/
@Configuration
@Slf4j
public class Config {

    @Value("${app}")
    private String app;

    //    @Bean
    //    public Consumer<String> topic() {
    //        return msg -> log.info("{} receive msg:{}", app, msg);
    //    }


    @Bean("topic1")
    public Consumer<String> topic1() {
        return msg -> log.info("{} receive msg:{}", app, msg);
    }

    @Bean("topic_2")
    public Consumer<String> topic2() {
        return msg -> log.info("{} receive msg:{}", app, msg);
    }

}
